package com.kai.service.data;

import com.kai.service.enums.ResultCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class PagingResult<T> extends Result<List<T>> implements Serializable {
    private static final long serialVersionUID = 2008968116071100625L;

    private long pageIndex;

    private long pageSize;

    private long total;

    public PagingResult(List<T> body, long pageIndex, long pageSize, long total) {
        this.setBody(body);
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
        this.total = total;
        this.setSuccess(true);
        this.setCode(ResultCodeEnum.SUCCESS.getCode());
        this.setMsg(ResultCodeEnum.SUCCESS.getMessage());
    }


}